﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows.Media;


namespace Chaos.model
{
    public class powersheet : INotifyPropertyChanged, stream.streamable
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected void Notify(string property)
        {
            if (this.PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }

        public ImageSource powersheetimage;
        public ImageSource PowerSheetImage
        {
            get { return powersheetimage; }
            set
            {
                if (powersheetimage != value)
                {
                    powersheetimage = value;
                    Notify("PowerSheetImage");
                }
            }
        }

        private int power;
        public int Power
        {
            get { return power; }
            set
            {
                if (power != value)
                {
                    power = value;
                    Notify("Power");
                }
            }
        }


        private String faction;
        public String Faction
        {
            get { return faction; }
            set
            {
                if (faction != value)
                {
                    faction = value;
                    Notify("Faction");
                }
            }
        }

        public virtual void serialize(stream.stream io_Stream)
        {
            int p = power;
            String f = faction;

            io_Stream.begin("powersheet")
                .serialize("Faction", ref f)
                .serialize("Power", ref p)
            .end();

            Power = p;
            Faction = f;
        }
    }
}
